{extend name="public/base" /}
{block name="body"}
<div class="layui-row layui-col-space15">
    <div class="layui-col-md12">
        <div class="layui-card">
            <div class="layui-card-header">
                文章内容列表
            </div>
            <div class="layui-card-body">
                <div class="layui-row zz-row-operate">
                    <div class="zz-operate-btn-group">
                        <a class="layui-btn" title="新增文章内容" href="{:url('add?cid='.$param.document_category_id)}">新 增</a>
                        <a class="layui-btn layui-btn-danger zz-btn-select-all" href="{:url('del')}">批量删除</a>
                    </div>
                    <form action="{:url('')}" class="layui-form zz-form-search zz-form zz-form-right">
                        <div class="layui-inline">
                            <div class="layui-input-inline">
                                <select name="document_category_id">
                                    <option value="">全部分类</option>
                                    {volist name="DocumentCategoryList" id="vo"}
                                        <option  value="{$vo.id}" {$param.document_category_id==$vo.id?'selected':''}>{$vo.title}</option>
                                    {/volist}
                                </select>
                            </div>
                            <div class="layui-input-inline">
                                <input type="text" name="title" placeholder="请输入文章标题" value="{$param['title']}" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <button class="layui-btn btn-search" lay-submit>
                                <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                            </button>
                        </div>
                    </form>
                </div>
                <div class="layui-form zz-table-list-container">
                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th width="18px">
                                <input type="checkbox" lay-filter="zz-checkbox-table" lay-skin="primary">
                            </th>
                            <th>ID</th>
                            <th>标题</th>
                            <th>文章分类</th>
                            <th>属性</th>
                            <th>是否显示</th>
                            <th>浏览量</th>
                            <th>排序</th>
                            <th>更新时间</th>
                            <th>
                                操作
                            </th>
                        </tr>
                        </thead>
                        <tbody>
                        {volist name="lists" id="vo"}
                        <tr>
                            <td><input type="checkbox" class="zz-table-chk-item" value="{$vo.id}" lay-skin="primary"></td>
                            <td>{$vo.id}</td>
                            <td>
                                <div class="document-title">
                                    {if $vo.cover_path}
                                    <a href="{$vo.cover_path}" target="_blank" class="lbtn-cover_path" style="background-image: url('{$vo.cover_path}');">
                                    </a>
                                    {/if}
                                    {$vo.title}
                                </div>
                            </td>
                            <td>{$vo.documentCategory.title}（ID:{$vo.documentCategory.id}）</td>
                            <td>
                                {if $vo.isrecommend=='不推荐'}
                                <span class="layui-badge layui-bg-gray">{$vo.isrecommend}</span>
                                {else/}
                                <span class="layui-badge layui-bg-blue">{$vo.isrecommend}</span>
                                {/if}
                                &nbsp;&nbsp;
                                {if $vo.istop=='不置顶'}
                                <span class="layui-badge layui-bg-gray">{$vo.istop}</span>
                                {else/}
                                <span class="layui-badge layui-bg-orange">{$vo.istop}</span>
                                {/if}
                            </td>
                            <td>
                                <input type="checkbox" lay-filter="zz-switch"  data-href="{:url('enable?id='.$vo['id'])}" name="display" value="{$vo.display=='显示'?'0':'1'}" {$vo.display=='显示'?'checked':''} lay-skin="switch" lay-text="显示|隐藏">
                            </td>

                            <td>{$vo.view}</td>
                            <td>
                                <form action="{:url('sort')}" method="post" class="layui-form zz-form-datalist" lay-filter="zz-form-{$vo.id}">
                                    <input type="hidden" value="{$vo.id}" name="id">
                                    <input type="text" name="sort" data-source="{$vo.sort}" lay-verify="required|number" autocomplete="off" value="{$vo.sort}" class="layui-input zz-table-input">
                                </form>
                            </td>
                            <td>{$vo.update_time}</td>
                            <td>
                                <a href="{:url('edit?id='.$vo['id'])}" class="layui-btn layui-btn-xs layui-btn-normal" title="编辑">编辑</a>
                                <a href="{:url('del?ids='.$vo['id'])}" class="layui-btn layui-btn-danger layui-btn-xs confirm ajax-post">删除</a>
                            </td>
                        </tr>
                        {/volist}
                        </tbody>
                    </table>
                    {if $lists->isEmpty()}
                        <div class="zz-data-empty">
                            <i class="layui-icon layui-icon-tips"></i>暂无记录！
                        </div>
                    {else/}
                        {$lists|raw}
                    {/if}
                </div>
            </div>
        </div>
    </div>
</div>
{/block}